<include file="Public/sui_header" />
<div class="user-img">
    <div class="row user-phote-div">
        <div class="col-20">
            <img src="/Public/file/{$user['photo']}" style="width:4rem;height:4rem;" class="img-round">
        </div>
        <div class="col-80 user-photo-info">
            {$user['name']}
            <br/> {$user['username']}
            <br/> {$user['location']}
        </div>
    </div>
</div>
<div style="font-size:1.2em">
    <span class="color-block">&nbsp;</span>&nbsp;请填写基本信息
</div>
<form method="post" enctype="multipart/form-data">
    <div class="card">
        <div class="card-content">
            <div class="card-content-inner">
                <div class="list-block">
                    <ul>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">姓名</div>
                                    <div class="item-input">
                                        <input type="text" name="name" value="{$user['name']}">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">电话</div>
                                    <div class="item-input">
                                        <input type="text" name="phone" value="{$user['username']}">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">消费地</div>
                                    <div class="item-input">
                                        <select name="region_id">
                                            <volist name="region" id="vo">
                                                <option value="{$vo['id']}">{$vo['name']}</option>
                                            </volist>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">类别</div>
                                    <div class="item-input">
                                        <select name="type" id="customized-type">
                                            <foreach name="fundingType" item="vo">
                                                <option value="{$vo['id']}">{$vo['long_name']}</option>
                                            </foreach>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div style="font-size:1.2em">
        <span class="color-block">&nbsp;</span>&nbsp;游客信息
        <a href="__MODULE__/Tourist/list?fromType=Customized" style="font-size: 0.8rem;">添加</a>
    </div>
    <div class="card">
        <div class="card-content">
            <div class="card-content-inner">
                <div class="list-block">
                    <ul>
                        <php>
                            $tourist = D('Tourist')->where(['user_id'=>session('用户')['id']])->select();
                        </php>
                        <volist name="tourist" id="vo">
                            <li>
                                <div class="item-content">
                                    <div class="item-inner">
                                        <label>
                                            <input type="checkbox" name="tourist[]" value="{$vo['id']}" > {$vo['name']}
                                        </label>
                                    </div>
                                </div>
                            </li>
                        </volist>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div style="font-size:1.2em">
        <span class="color-block">&nbsp;</span>&nbsp;保险信息
    </div>
    <div class="card">
        <div class="card-content">
            <div class="card-content-inner">
                <div class="list-block">
                    <ul>
                        <php>
                            $insurance = D('Insurance')->select();
                        </php>
                        <volist name='insurance' id="vo">
                            <li>
                                <div class="item-content">
                                    <div class="item-inner">
                                        <label>
                                            <input type="checkbox" name="insurance[]" value="{$vo['id']}" <if condition="$vo['is_force'] eq '是'"> checked class="force-insurance" </if>> {$vo['name']} | ￥{$vo['price']}
                                        </label>
                                        <a href="{:U('Insurance/detail', ['id'=>$vo['id']])}">详情</a>
                                    </div>
                                </div>
                            </li>
                        </volist>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    
    <div class="row detail-submit">
        <div class="col-50"><a href="#" class="button button-big button-fill button-info close-panel return">返回</a></div>
        <div class="col-50">
            <input value="提交" type="submit" class="button button-big button-fill button-success" />
        </div>
    </div>
</form>
<include file="Public/sui_footer" />
<script type="text/javascript">
$(document).ready(function(){
      $("#customized-type").change(function(){
            if ($("#customized-type").find("option:selected").text() == '旅游') {
                $('.force-insurance').prop("checked","checked");
                $('.force-insurance').attr('onclick', 'return false;');
            } else {
                $('.force-insurance').attr('onclick', '');
            }
      });
});
</script>